package com.aspose.cells;

import java.util.ArrayList;

final class zalc {
   static int a = 4;
   static float b = 0.4F;
   static float c = 5.0F;

   private static com.aspose.cells.b.a.b.zt c(zn var0, zakw var1) {
      zbcr var3 = var1.d().a().z();
      com.aspose.cells.b.a.b.zt var4 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);

      for(int var6 = 0; var6 < var3.getCount(); ++var6) {
         zbcp var2 = var3.c(var6);
         com.aspose.cells.b.a.b.zt var5 = var0.a(var2.i(), var1.d().h());
         if (var4.b() < var5.b()) {
            var4.a(var5.b());
         }

         if (var4.c() < var5.c()) {
            var4.b(var5.c());
         }
      }

      return var4;
   }

   private static boolean a(zbcr var0) {
      if (var0.o()) {
         return true;
      } else {
         boolean var1 = false;

         for(int var2 = 0; var2 < var0.getCount(); ++var2) {
            zbcp var3 = var0.c(var2);
            if (var3.z().e() && !b(var3.m()) && !var3.au()) {
               var1 = true;
               break;
            }
         }

         return var1;
      }
   }

   static com.aspose.cells.b.a.b.zt a(zn var0, zakw var1) {
      com.aspose.cells.b.a.b.zt var2 = c(var0, var1);
      boolean var3 = a(var1.d().a().z());
      if (var2.b() == 0.0F) {
         return var3 ? new com.aspose.cells.b.a.b.zt(28.0F, (float)var1.j()) : new com.aspose.cells.b.a.b.zt((float)var1.m(), (float)var1.j());
      } else {
         float var5;
         if (var2.b() != 0.0F) {
            float var7 = var2.c() * b;
            var5 = var2.c();
            if (var3) {
               var7 = 3.0F * var5 / 2.0F;
            }

            return new com.aspose.cells.b.a.b.zt(var7, var5);
         } else {
            com.aspose.cells.b.a.b.zs var4 = zbsp.a(var0, "This is a girl", var1.d().h());
            var5 = (float)var4.c() * b;
            float var6 = (float)var4.c();
            if (var3) {
               var5 = 3.0F * var6 / 2.0F;
            }

            return new com.aspose.cells.b.a.b.zt(var5, var6);
         }
      }
   }

   static void a(zakw var0, com.aspose.cells.b.a.b.zp var1) {
      com.aspose.cells.b.a.b.zs var2 = var0.d().b.b();
      int var3 = var1.f();
      int var4 = var1.e();
      switch(var0.e()) {
      case 0:
      case 5:
         if (var4 > var2.b()) {
            var0.d().b.a(var1.c() + (var4 - var2.b()) / 2);
         }
      case 1:
      case 3:
      default:
         break;
      case 2:
      case 4:
         if (var3 > var2.c()) {
            var0.d().b.b(var1.d() + (var3 - var2.c()) / 2);
         }
      }

   }

   private static boolean b(int var0) {
      return var0 != 37 && var0 != 40 && var0 != 41 && var0 != 42 && var0 != 38 && var0 != 39 && var0 != 60 && var0 != 63 && var0 != 64 && var0 != 61 && var0 != 62 && var0 != 57 && var0 != 12;
   }

   static boolean a(int var0) {
      return var0 == 40 || var0 == 41 || var0 == 42 || var0 == 60 || var0 == 63 || var0 == 61 || var0 == 58 || var0 == 12;
   }

   static void a(zn var0, com.aspose.cells.b.a.b.zq var1, zbcp var2) {
      int var3 = var2.m();
      float var4;
      if (b(var3)) {
         var4 = var1.h();
         com.aspose.cells.b.a.b.zq var9 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + var1.i() / 2.0F - var4 / 2.0F, var4, var4);
         var9 = zbuk.a(var9);
         zax.a(var0, var9, var2.A());
         zama.a(var0, var9, var2.z());
      } else {
         if (var2.z().e()) {
            zama.a(var0, var1.f(), var1.g() + var1.i() / 2.0F, var1.f() + var1.h(), var1.g() + var1.i() / 2.0F, var2.z());
         }

         if (a(var3)) {
            var4 = var1.f() + var1.h() / 2.0F;
            float var5 = var1.g() + var1.i() / 2.0F;
            float var6;
            if (var2.B().c() == 0) {
               var6 = var1.i() * b;
            } else {
               int var7 = (int)((float)(var2.h().c() * 72) / var0.g());
               if ((float)var7 <= var1.i() * b) {
                  var6 = (float)var2.B().c();
               } else {
                  float var8 = (float)(var7 / var2.v().i().m());
                  if (var8 > 1.0F) {
                     var8 = 1.0F;
                  }

                  var6 = var1.i() * b * (1.0F + var8);
                  var6 = (float)((int)((double)(var6 * var0.g() / 72.0F) + 0.5D));
               }
            }

            var2.B().a((int)var6);
            a(var0, var4, var5, var2.B(), (float)var2.B().c(), true);
         }

      }
   }

   static int a(zbcp var0, int var1) {
      if (var1 == -1) {
         return 3;
      } else if (var0.m() == 12) {
         return 7;
      } else {
         var1 %= 9;
         var1 += 2;
         switch(var1) {
         case 2:
            return 2;
         case 3:
            return 3;
         case 4:
            return 4;
         case 5:
            return 5;
         case 6:
            return 6;
         case 7:
            return 7;
         case 8:
            return 8;
         case 9:
            return 9;
         case 10:
            return 10;
         default:
            return 1;
         }
      }
   }

   static void a(zn var0, float var1, float var2, zamt var3, float var4, boolean var5) {
      if (var3.d() != 1) {
         com.aspose.cells.b.a.b.zu var6 = new com.aspose.cells.b.a.b.zu(var3.e().e());

         try {
            com.aspose.cells.b.a.b.zm var7 = new com.aspose.cells.b.a.b.zm(var3.f().a());

            try {
               com.aspose.cells.b.a.b.zu var8 = new com.aspose.cells.b.a.b.zu(var3.f().a());

               try {
                  int var9 = var3.d();
                  float var10;
                  float var11;
                  switch(var9) {
                  case 2:
                     --var4;
                     com.aspose.cells.b.a.b.zo[] var12 = new com.aspose.cells.b.a.b.zo[4];
                     zbuk.a(var12);
                     var12[0].a(var1 - var4 / 2.0F);
                     var12[0].b(var2);
                     var12[1].a(var1);
                     var12[1].b(var2 - var4 / 2.0F);
                     var12[2].a(var1 + var4 / 2.0F);
                     var12[2].b(var2);
                     var12[3].a(var1);
                     var12[3].b(var2 + var4 / 2.0F);
                     var0.a((com.aspose.cells.b.a.b.zc)var6, (com.aspose.cells.b.a.b.zo[])var12);
                     var0.c(var7, var12);
                     break;
                  case 3:
                     var4 -= 2.0F;
                     var1 -= var4 / 2.0F;
                     var2 -= var4 / 2.0F;
                     var0.b((com.aspose.cells.b.a.b.zc)var6, var1, var2, var4, var4);
                     var0.c(var7, var1, var2, var4, var4);
                     break;
                  case 4:
                     --var4;
                     com.aspose.cells.b.a.b.zo[] var13 = new com.aspose.cells.b.a.b.zo[3];
                     zbuk.a(var13);
                     var13[0].a(var1 - var4 / 2.0F);
                     var13[0].b(var2 + var4 / 2.0F);
                     var13[1].a(var1);
                     var13[1].b(var2 - var4 / 2.0F);
                     var13[2].a(var1 + var4 / 2.0F);
                     var13[2].b(var2 + var4 / 2.0F);
                     var0.a((com.aspose.cells.b.a.b.zc)var6, (com.aspose.cells.b.a.b.zo[])var13);
                     var0.c(var7, var13);
                     break;
                  case 5:
                     var1 -= var4 / 2.0F;
                     var2 -= var4 / 2.0F;
                     var0.b((com.aspose.cells.b.a.b.zc)var6, var1, var2, var4, var4);
                     var0.b(var7, var1 + 2.0F, var2 + 2.0F, var1 + var4 - 2.0F, var2 + var4 - 2.0F);
                     var0.b(var7, var1 + 2.0F, var2 + var4 - 2.0F, var1 + var4 - 2.0F, var2 + 2.0F);
                     break;
                  case 6:
                     var4 -= 2.0F;
                     var1 -= var4 / 2.0F;
                     var2 -= var4 / 2.0F;
                     var0.b((com.aspose.cells.b.a.b.zc)var6, var1, var2, var4, var4);
                     var0.b(var7, var1, var2, var1 + var4, var2 + var4);
                     var0.b(var7, var1, var2 + var4, var1 + var4, var2);
                     var0.b(var7, var1 + var4 / 2.0F, var2, var1 + var4 / 2.0F, var2 + var4);
                     break;
                  case 7:
                     if (var5) {
                        if (var4 <= 4.0F) {
                           --var4;
                        } else {
                           var4 -= 2.0F;
                        }
                     } else {
                        --var4;
                     }

                     var1 -= var4 / 2.0F;
                     var2 -= var4 / 2.0F;
                     var0.a((com.aspose.cells.b.a.b.zc)var6, var1, var2, var4, var4);
                     var0.a(var7, var1, var2, var4, var4);
                     break;
                  case 8:
                     var4 -= 2.0F;
                     var1 -= var4 / 2.0F;
                     var2 -= var4 / 2.0F;
                     var0.b((com.aspose.cells.b.a.b.zc)var6, var1, var2, var4, var4);
                     var0.b(var7, var1, var2 + var4 / 2.0F, var1 + var4, var2 + var4 / 2.0F);
                     var0.b(var7, var1 + var4 / 2.0F, var2, var1 + var4 / 2.0F, var2 + var4);
                     break;
                  case 9:
                     var10 = (float)((int)(Math.ceil((double)var4) / 2.0D + 1.0D));
                     var11 = (float)((int)(var4 / 5.0F) / 2 * 2);
                     var11 = var11 < 2.0F ? 2.0F : var11;
                     var2 -= var11 / 2.0F;
                     var0.b((com.aspose.cells.b.a.b.zc)var8, var1, var2, var10, var11);
                     break;
                  case 10:
                     var10 = (float)((int)(Math.ceil((double)var4) / 2.0D + 1.0D));
                     var10 *= 2.0F;
                     var11 = (float)((int)(var4 / 5.0F) / 2 * 2);
                     var11 = var11 < 2.0F ? 2.0F : var11;
                     var1 -= var10 / 2.0F;
                     var2 -= var11 / 2.0F;
                     var0.b((com.aspose.cells.b.a.b.zc)var8, var1, var2, var10, var11);
                  }
               } finally {
                  if (var8 != null) {
                     var8.f();
                  }

               }
            } finally {
               if (var7 != null) {
                  var7.r();
               }

            }
         } finally {
            if (var6 != null) {
               var6.f();
            }

         }

      }
   }

   static boolean a(zif var0) throws Exception {
      if (var0.z().getCount() != 1) {
         return false;
      } else {
         zbcp var1 = var0.z().c(0);
         int[] var2 = new int[]{14, 16, 17, 20, 18, 19, 15, 6, 8, 11, 9, 7, 37, 39, 42, 43, 38, 41, 40, 60, 61, 62, 63, 64, 57, 59, 58, 12, 13, 28, 30, 31, 33, 32, 34, 29, 21, 23, 22, 24, 26, 25, 27, 50, 52, 53, 55, 54, 56, 51};

         int var3;
         for(var3 = 0; var3 < var2.length && var1.m() != var2[var3]; ++var3) {
            ;
         }

         if (var3 == var2.length) {
            return false;
         } else {
            zjf var4 = var1.D();
            int var5 = var1.m();
            if (var1.H()) {
               return true;
            } else {
               return var4.getCount() > 0 && !a(var4);
            }
         }
      }
   }

   private static boolean a(zjf var0) throws Exception {
      for(int var1 = 1; var1 < var0.getCount(); ++var1) {
         if (!var0.b(0).i().a(var0.b(var1).i()) || !var0.b(0).k().a(var0.b(var1).k()) || !var0.b(0).m().a(var0.b(var1).m())) {
            return false;
         }
      }

      return true;
   }

   static void a(zn var0, zakw var1, zbcp var2) throws Exception {
      var1.d().z();
      zaky var3 = var1.f();
      int var4 = var1.f().a();
      zif var5 = var1.c();
      ziy.a(var0, var1.d());
      float var6 = (float)var5.b() / 3.0F;
      com.aspose.cells.b.a.b.zt var7 = b(var0, var1);
      int var8 = var1.k();
      int var9 = var1.l();
      float var10 = var1.p();
      float var11 = var1.q();
      int var12 = 1;
      int var13 = var1.d().a.e();
      int var14 = var1.d().a.f();
      float var17 = 0.0F;
      float var18 = 0.0F;
      com.aspose.cells.b.a.b.zt var19 = com.aspose.cells.b.a.b.zt.a();
      int var20 = 0;
      com.aspose.cells.b.a.b.zt var21 = com.aspose.cells.b.a.b.zt.a();
      com.aspose.cells.b.a.b.zt var22 = a(var0, var1, new com.aspose.cells.b.a.b.zt((float)var5.a(), (float)var5.b()));
      int var23 = (int)(var7.b() * (float)var4 + var22.b());
      boolean var24 = false;
      int var15;
      if (var23 <= var13 - var8) {
         var15 = var4;
         byte var16 = 1;
         var17 = (float)(var13 - var8 - var23) / (float)var4;
         var18 = (float)(var14 - var1.j() * var16) / (float)var16;
         var24 = true;
      } else {
         int var25 = var1.d().a.e() - var8;
         int var26 = var25 - (int)var7.b();
         var21 = new com.aspose.cells.b.a.b.zt((float)var26, var6);
         var19 = b(var0, var1, var21);
         var20 = (int)(var7.b() + var19.b());
         var15 = var20 == 0 ? 1 : zbuk.b((double)((float)var25 / (float)var20));
         if (var15 < 1) {
            var15 = 1;
         }

         int var38 = zbuk.a((double)((float)var4 / (float)var15));
         if (var38 > 1 && var15 > var38) {
            int var27 = (int)Math.ceil((double)((float)var4 / (float)var38));
            if (var27 < var15) {
               var15 = var27;
            }
         }

         var17 = (float)(var25 - var20 * var15) / (float)var15;
         var18 = ((float)var14 - var19.c() * (float)var38) / (float)var38;
         var12 = zbuk.a((double)(var19.c() / var1.d().C()));
      }

      if (var17 < 0.0F) {
         var17 = 0.0F;
      }

      if (var12 > 1) {
         if (var18 < var11) {
            var18 = var11;
         }
      } else if (var18 < var10) {
         var18 = var10;
      }

      float var39 = (float)var1.d().a.c();
      float var40 = (float)var1.d().a.d();
      var39 += (float)var8;
      var39 += var17 / 2.0F;
      var40 += Math.abs(var18) / 2.0F;
      com.aspose.cells.b.a.b.a.zf var41 = var0.e();
      com.aspose.cells.b.a.b.zq var28 = var0.f();
      var0.a(var1.d().a);
      com.aspose.cells.b.a.b.zv var29 = new com.aspose.cells.b.a.b.zv(com.aspose.cells.b.a.b.zv.c());

      for(int var30 = 0; var30 < var3.getCount(); ++var30) {
         zala var31 = var3.b(var30);
         if (var40 > (float)var1.d().a.j()) {
            break;
         }

         com.aspose.cells.b.a.b.zq var32 = new com.aspose.cells.b.a.b.zq(var39, var40, var7.b(), var7.c());
         a(var0, var32, var2, var30);
         String var33 = var31.g();
         com.aspose.cells.b.a.b.zo var34 = new com.aspose.cells.b.a.b.zo(var39 + var7.b() + (float)var9, var40);
         if (var24) {
            var0.a(var33, var31.c(), new com.aspose.cells.b.a.b.zu(var31.e()), var34.d(), var34.e(), var29);
            com.aspose.cells.b.a.b.zs var35 = var1.d().a.b();
            if ((float)var35.c() < var1.d().C()) {
               var35.b(zbuk.c((double)(var1.d().C() + 1.0F)));
            }

            com.aspose.cells.b.a.b.zt var36 = zbuk.a(var0, var33, var1.d().h(), var35);
            var39 += var7.b() + var36.b() + (float)(2 * var9);
            if (var5.aq() == ImageFormat.getEmf() && var31.c().h() <= 8.0F) {
               if (var31.c().h() <= 6.0F) {
                  var39 += (float)var33.length() / 5.0F * (float)var9;
               } else if (var31.c().h() <= 8.0F) {
                  var39 += (float)var33.length() / 10.0F * (float)var9;
               }
            }

            var39 += var17;
         } else {
            float var42 = (float)zbuk.a((double)var21.b());
            float var43 = (float)zbuk.a((double)var21.c());
            com.aspose.cells.b.a.b.zq var37 = new com.aspose.cells.b.a.b.zq(var34.d(), var34.e(), var42, var43);
            var0.a(var33, var31.c(), new com.aspose.cells.b.a.b.zu(var31.e()), (com.aspose.cells.b.a.b.zq)var37, var29);
            var39 += (float)var20;
            var39 += var17;
            if ((var30 + 1) % var15 == 0) {
               var39 = (float)(var1.d().a.c() + var8) + var17 / 2.0F;
               var40 += var19.c();
               var40 += var18;
            }
         }
      }

      var0.a(var41);
   }

   static void a(zn var0, com.aspose.cells.b.a.b.zq var1, zbcp var2, int var3) {
      int var4 = var2.m();
      Color var5 = var2.v().g(var2.aw()).a(var2.ai());
      zjd var6 = var2.D().b(var3);
      if (var6 == null) {
         var6 = var2.u();
      }

      float var7;
      com.aspose.cells.b.a.b.zq var18;
      if (var2.au()) {
         var7 = (float)var2.v().x().m();
         var18 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + (var1.i() - var7) / 2.0F, var7, var7);
         com.aspose.cells.b.a.b.zc var20 = zax.a(var6.i(), var18);

         try {
            var0.a(var20, var18);
         } finally {
            if (var20 != null) {
               var20.f();
            }

         }

         com.aspose.cells.b.a.b.zm var19 = zama.a(var6.k());

         try {
            var0.a(var19, var18);
         } finally {
            if (var19 != null) {
               var19.r();
            }

         }

      } else if (b(var4)) {
         var7 = var1.h();
         var18 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + var1.i() / 2.0F - var7 / 2.0F, var7, var7);
         var18 = zbuk.a(var18);
         zax.a(var0, var18, var6.i());
         zama.a(var0, var18, var6.k());
      } else {
         if (var2.z().e() && var2.m() != 12 && var2.m() != 13) {
            zama.a(var0, var1.f(), var1.g() + var1.i() / 2.0F, var1.f() + var1.h(), var1.g() + var1.i() / 2.0F, var6.k());
         }

         if (a(var4)) {
            var7 = var1.f() + var1.h() / 2.0F;
            float var8 = var1.g() + var1.i() / 2.0F;
            float var9;
            if (var2.B().c() == 0) {
               var9 = var1.i() * b;
            } else {
               int var10 = (int)((float)(var2.h().c() * 72) / var0.g());
               if ((float)var10 <= var1.i() * b) {
                  var9 = (float)var2.B().c();
               } else {
                  float var11 = (float)(var10 / var2.v().i().m());
                  if (var11 > 1.0F) {
                     var11 = 1.0F;
                  }

                  var9 = var1.i() * b * (1.0F + var11);
                  var9 = (float)((int)((double)(var9 * var0.g() / 72.0F) + 0.5D));
               }
            }

            a(var0, var7, var8, var6.m(), var9, true);
         }

      }
   }

   static String a(zif var0, zfo var1, boolean var2) {
      String var3 = var1.c();
      if (var1.f()) {
         double var4 = com.aspose.cells.b.a.ze.g(var1.a());
         DateTime var6 = zbuk.a(var4, var2);
         return zgc.a(var0.al(), var6, var3);
      } else {
         return zgc.a(var0.al(), var1.a(), var3);
      }
   }

   static com.aspose.cells.b.a.b.zs b(zn var0, zakw var1, zbcp var2) throws Exception {
      if (!var1.d().s()) {
         return var1.d().t();
      } else {
         int var3 = var1.f().a();
         int var7 = var1.k();
         com.aspose.cells.b.a.b.zt var4;
         int var5;
         int var6;
         com.aspose.cells.b.a.b.zt var8;
         if (var1.e() == 5 || var1.e() == 0 || var1.e() == 3 && !var1.i()) {
            var8 = new com.aspose.cells.b.a.b.zt((float)(var1.c().a() - 2 * zhz.a), (float)(var1.c().j().m() / 2 - zhz.a));
            com.aspose.cells.b.a.b.zt var18 = b(var0, var1);
            com.aspose.cells.b.a.b.zt var19 = b(var0, var1, var8);
            int var20 = (int)(var18.b() + var19.b()) + 1;
            int var12 = var1.c().j().l() - 2 * zhz.a - var7;
            int var13 = var12 / var20;
            if (var13 == 0) {
               var13 = 1;
            }

            var4 = a(var0, var1, var8);
            int var14 = (int)(var18.b() * (float)var3 + var4.b()) + 1;
            if (var14 <= var12) {
               var5 = var7 + var14;
               var6 = (int)var4.c() + 2 * var7;
            } else {
               var5 = var7 + var13 * var20;
               var6 = zbuk.a((double)((float)var3 / (float)var13)) * (int)var4.c() + 2 * var7;
               int var15 = var1.c().j().m() / 2 - zhz.a;
               if (var6 > var15) {
                  int var16 = 0;

                  int var17;
                  for(var17 = 0; var16 <= var15 && var17 <= var3; var17 += var13) {
                     var16 = zbuk.a((double)((float)var17 / (float)var13)) * (int)var4.c() + 2 * var7;
                  }

                  if (var17 < var3 && var16 != var15) {
                     if (var16 > var15) {
                        var6 = var16 - (int)var4.c();
                     }
                  } else {
                     var6 = var16;
                  }
               }
            }

            if (var6 > var1.c().j().m() - 2 * zhz.a) {
               var6 = var1.c().j().m() - 2 * zhz.a;
            }
         } else {
            int var9 = var1.c().j().m() - 2 * zhz.a;
            int var10 = var1.c().a() / 3;
            var8 = new com.aspose.cells.b.a.b.zt((float)var10, (float)var9);
            com.aspose.cells.b.a.b.zt var11 = b(var0, var1);
            var4 = b(var0, var1, var8);
            var5 = (int)((float)var7 + var11.b() + var4.b()) + 1;
            var6 = (int)(var4.c() + (float)(2 * var7) + (float)(var3 - 1) * var4.c());
            if (var5 > var10) {
               var5 = var10;
            }

            if (var6 > var9) {
               var6 = var9;
            }
         }

         return new com.aspose.cells.b.a.b.zs(var5, var6);
      }
   }

   static com.aspose.cells.b.a.b.zn a(zn var0, zakw var1, zbcp var2, com.aspose.cells.b.a.b.zp[] var3) throws Exception {
      float var4 = 0.0F;
      float var5 = 0.0F;
      com.aspose.cells.b.a.b.zs var6 = b(var0, var1, var2);
      int var7 = var1.c().b();
      int var8 = var1.c().a();
      int var9 = zhz.a;
      int var10 = zhz.b;
      zif var11 = var1.c();
      var1.d().b.a(var6);
      switch(var1.e()) {
      case 0:
         var4 = (float)((var8 - var6.b()) / 2);
         var5 = (float)(var7 - var9 - var6.c());
         var3[0].d(var3[0].f() - (var6.c() + var10));
         var11.c.d(var3[0].j() - var11.c.d());
         break;
      case 1:
         var4 = (float)(var8 - var9 - var6.b());
         if (var1.c().K().j()) {
            var5 = (float)(var9 + var1.c().K().e().b.f() + var10);
         } else {
            var5 = (float)var9;
         }

         var3[0].c(var3[0].e() - (var6.b() + var10));
         if (var6.c() * 2 < var3[0].f()) {
            var3[0].d(var3[0].f() - (var6.c() + var10));
         }
         break;
      case 2:
         var4 = (float)var9;
         var5 = (float)((var7 - var6.c()) / 2);
         var3[0].a(var3[0].c() + var6.b() + var10);
         var3[0].c(var3[0].e() - (var6.b() + var10));
         if (var3[0].c() - var10 - var11.c.c() > 0) {
            var11.c.c(var11.c.e() - (var3[0].c() - var10 - var11.c.c()));
            var11.c.a(var3[0].c() - var10);
         }
         break;
      case 3:
         var4 = (float)(var1.d().n() * var1.c().a() / 4000);
         var5 = (float)(var1.d().o() * var1.c().b() / 4000);
         var1.d().b.a((int)var4);
         var1.d().b.b((int)var5);
         var1.d().b.a(var6);
         return new com.aspose.cells.b.a.b.zn(var1.d().b.c(), var1.d().b.d());
      case 4:
         var4 = (float)(var8 - var9 - var6.b());
         var5 = (float)((var7 - var6.c()) / 2);
         var3[0].c(var3[0].e() - (var6.b() + var10));
         var11.c.c(var3[0].i() - var11.c.c());
         break;
      case 5:
         var4 = (float)((var8 - var6.b()) / 2);
         var5 = (float)(var9 + var1.c().K().e().b.f() + var10);
         var3[0].b(var3[0].d() + var6.c() + var10);
         var3[0].d(var3[0].f() - (var6.c() + var10));
         if (var3[0].d() - var10 - var11.c.d() > 0) {
            var11.c.d(var11.c.f() - (var3[0].d() - var10 - var11.c.d()));
            var11.c.b(var3[0].d() - var10);
         }
      }

      var1.d().b.a((int)var4);
      var1.d().b.b((int)var5);
      var1.d().b.a(var6);
      return new com.aspose.cells.b.a.b.zn(var1.d().b.c(), var1.d().b.d());
   }

   static com.aspose.cells.b.a.b.zn a(zn var0, zakw var1, com.aspose.cells.b.a.b.zp[] var2) throws Exception {
      float var3 = 0.0F;
      float var4 = 0.0F;
      com.aspose.cells.b.a.b.zs var5 = a(var0, var1, false);
      int var6 = var1.d().a().b();
      int var7 = var1.d().a().a();
      int var8 = zhz.a;
      int var9 = zhz.b;
      zif var10 = var1.c();
      switch(var1.e()) {
      case 0:
         var3 = (float)((var7 - var5.b()) / 2);
         var4 = (float)(var6 - var8 - var5.c());
         var2[0].d(var2[0].f() - (var5.c() + var9));
         var10.c.d(var2[0].j() - var10.c.d());
         break;
      case 1:
         var3 = (float)(var7 - var8 - var5.b());
         if (var1.d().a().K().j()) {
            var4 = (float)(var8 + var1.d().a().K().e().b.f() + var9);
         } else {
            var4 = (float)var8;
         }

         var2[0].c(var2[0].e() - (var5.b() + var9));
         if (var2[0].f() > var5.c() * 2) {
            var2[0].b(var2[0].d() + var5.c() + var9);
            var2[0].d(var2[0].f() - (var5.c() + var9));
         }
         break;
      case 2:
         var3 = (float)var8;
         var4 = (float)((var6 - var5.c()) / 2);
         var2[0].a(var2[0].c() + var5.b() + var9);
         var2[0].c(var2[0].e() - (var5.b() + var9));
         if (var2[0].c() - var9 - var10.c.c() > 0) {
            var10.c.c(var10.c.e() - (var2[0].c() - var9 - var10.c.c()));
            var10.c.a(var2[0].c() - var9);
         }
         break;
      case 3:
         int var11 = 4000 * var5.b() / (var1.c().a() - 2 * zhz.c);
         int var12 = 4000 * var5.c() / (var1.c().b() - 2 * zhz.c);
         if (var1.d().n() + var11 > 4000) {
            var5 = a(var0, var1, true);
            var11 = 4000 * var5.b() / (var1.c().a() - 2 * zhz.c);
            var12 = 4000 * var5.c() / (var1.c().b() - 2 * zhz.c);
            if (var1.d().n() + var11 > 4000) {
               var1.d().c(4000 - var11);
            }

            if (var1.d().n() < 0) {
               var1.d().c(0);
            }

            if (var1.d().o() + var12 > 4000) {
               var1.d().d(4000 - var12);
            }

            if (var1.d().o() < 0) {
               var1.d().d(0);
            }
         }

         var3 = (float)var1.d().w();
         var4 = (float)var1.d().x();
         int var13 = var1.d().u();
         if (var13 > var5.b()) {
            var3 += (float)((var13 - var5.b()) / 2);
         }

         var1.d().b.a((int)var3);
         var1.d().b.b((int)var4);
         var1.d().b.a(var5);
         return new com.aspose.cells.b.a.b.zn(var1.d().b.c(), var1.d().b.d());
      case 4:
         var3 = (float)(var7 - var8 - var5.b());
         var4 = (float)((var6 - var5.c()) / 2);
         var2[0].c(var2[0].e() - (var5.b() + var9));
         var10.c.c(var2[0].i() - var10.c.c());
         break;
      case 5:
         var3 = (float)((var7 - var5.b()) / 2);
         var4 = (float)(var8 + var1.d().a().K().e().b.f() + var9);
         var2[0].b(var2[0].d() + var5.c() + var9);
         var2[0].d(var2[0].f() - (var5.c() + var9));
         if (var2[0].d() - var9 - var10.c.d() > 0) {
            var10.c.d(var10.c.f() - (var2[0].d() - var9 - var10.c.d()));
            var10.c.b(var2[0].d() - var9);
         }
      }

      var1.d().b.a((int)var3);
      var1.d().b.b((int)var4);
      var1.d().b.a(var5);
      return new com.aspose.cells.b.a.b.zn(var1.d().b.c(), var1.d().b.d());
   }

   static com.aspose.cells.b.a.b.zs a(zn var0, zakw var1, boolean var2) throws Exception {
      com.aspose.cells.b.a.b.zt var3 = b(var0, var1);
      int var6;
      if (!var1.d().s()) {
         com.aspose.cells.b.a.b.zs var20 = var1.d().t();
         com.aspose.cells.b.a.b.zt var21 = b(var0, var1, new com.aspose.cells.b.a.b.zt((float)var1.d().a().a(), (float)var1.d().a().b()));
         var6 = zbuk.a((double)(var3.b() + var21.b()));
         if (zbuk.b((double)(var20.b() / var6)) >= 2) {
            var1.c(false);
         } else {
            var1.c(true);
         }

         return var20;
      } else {
         int var4;
         int var5;
         int var9;
         com.aspose.cells.b.a.b.zt var11;
         int var12;
         if (var1.e() == 3) {
            var4 = var1.d().a().j().m() - 2 * zhz.a;
            var5 = var1.d().a().a() / 3;
            var6 = zbuk.b((double)((float)(var5 - var1.k()) - var3.b()));
            com.aspose.cells.b.a.b.zt var7 = new com.aspose.cells.b.a.b.zt((float)var6, (float)var4);
            com.aspose.cells.b.a.b.zt var8 = b(var0, var1, var7);
            var9 = zbuk.a((double)((float)var1.k() + var3.b() + var8.b()));
            int var10 = var1.d().u();
            var11 = a(var0, var1, var7);
            var12 = zbuk.a((double)(var3.b() * (float)var1.f().a() + var11.b()));
            if (var2 && var12 > var10 && var10 < 3 * var9 / 2) {
               var1.a(true);
            }
         }

         var4 = var1.k();
         var5 = var1.l();
         zbcr var22 = var1.d().a().z();
         var9 = var1.f().a();
         int var13;
         int var14;
         int var23;
         int var24;
         com.aspose.cells.b.a.b.zt var25;
         if (var1.e() != 5 && var1.e() != 0 && (var1.e() != 3 || var1.i())) {
            var1.c(true);
            var12 = var1.d().a().j().m() - 2 * zhz.a;
            var13 = var1.d().a().a() / 3;
            var14 = zbuk.b((double)((float)(var13 - var4) - var3.b()));
            var25 = new com.aspose.cells.b.a.b.zt((float)var14, (float)var12);
            var11 = b(var0, var1, var25);
            var23 = zbuk.a((double)((float)var4 + var3.b() + var11.b()));
            var24 = zbuk.a((double)((float)var4 + (float)var9 * (var11.c() + (float)var5)));
            if (var23 > var13) {
               var23 = var13;
            }

            if (var24 > var12) {
               var24 = var12;
            }
         } else {
            var25 = new com.aspose.cells.b.a.b.zt((float)(var1.d().a().a() - 2 * zhz.a), (float)(var1.d().a().j().m() / 2 - zhz.a));
            var11 = b(var0, var1, var25);
            var12 = zbuk.a((double)(var3.b() + var11.b()));
            var13 = zbuk.c((double)var25.b()) - var4;
            var14 = var13 / var12;
            if (var14 == 0) {
               var14 = 1;
            }

            com.aspose.cells.b.a.b.zt var15 = a(var0, var1, var25);
            int var16 = zbuk.a((double)(var3.b() * (float)var9 + var15.b()));
            if (var16 <= var13) {
               var1.c(false);
               var23 = var4 + var16 + var5;
               var24 = zbuk.a((double)(var15.c() + (float)(2 * var4)));
            } else {
               if (var14 > 1) {
                  var1.c(false);
               }

               var23 = var4 + var14 * var12 + var5;
               var24 = zbuk.a((double)((float)var9 / (float)var14)) * (zbuk.a((double)var11.c()) + var5) + 2 * var4;
               int var17 = var1.d().a().j().m() / 2 - zhz.a;
               if (var24 > var17) {
                  int var18 = 0;

                  int var19;
                  for(var19 = 0; var18 <= var17 && var19 <= var9; var19 += var14) {
                     var18 = zbuk.a((double)((float)var19 / (float)var14)) * (zbuk.a((double)var11.c()) + var5) + 2 * var4;
                  }

                  if (var19 < var9 && var18 != var17) {
                     if (var18 > var17) {
                        var24 = var18 - (zbuk.a((double)var11.c()) + var5);
                     }
                  } else {
                     var24 = var18;
                  }
               }
            }

            if (var24 > var1.d().a().j().m() - 2 * zhz.a) {
               var24 = var1.d().a().j().m() - 2 * zhz.a;
            }
         }

         return new com.aspose.cells.b.a.b.zs(var23, var24);
      }
   }

   static com.aspose.cells.b.a.b.zt a(zn var0, zakw var1, com.aspose.cells.b.a.b.zt var2) {
      zif var3 = var1.d().a();
      zaky var4 = var1.f();
      com.aspose.cells.b.a.b.zt var5 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
      int var7 = var1.l();

      for(int var8 = 0; var8 < var4.getCount(); ++var8) {
         String var9 = var4.b(var8).g();
         if (!var4.b(var8).b()) {
            com.aspose.cells.b.a.b.zt var6 = zbuk.a(var0, var9, var4.b(var8).c(), var2);
            var6.a(var6.b() + (float)(2 * var7));
            if (var3.aq() == ImageFormat.getEmf() && var4.b(var8).c().h() <= 10.0F) {
               if (var4.b(var8).c().h() <= 6.0F) {
                  var6.a(var6.b() + (float)var9.length() / 5.0F * (float)var7);
               } else if (var4.b(var8).c().h() <= 8.0F) {
                  var6.a(var6.b() + (float)var9.length() / 10.0F * (float)var7);
               } else if (var4.b(var8).c().h() <= 10.0F) {
                  var6.a(var6.b() + (float)var9.length() / 25.0F * (float)var7);
               }
            }

            var5.a(var5.b() + var6.b());
            if (var5.c() < var6.c()) {
               var5.b(var6.c());
            }
         }
      }

      return var5;
   }

   static com.aspose.cells.b.a.b.zt b(zn var0, zakw var1) {
      return var1.f().b() ? var1.o() : new com.aspose.cells.b.a.b.zt((float)var1.m(), var1.d().C());
   }

   static com.aspose.cells.b.a.b.zt b(zn var0, zakw var1, com.aspose.cells.b.a.b.zt var2) {
      zaky var4 = var1.f();
      com.aspose.cells.b.a.b.zt var5 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
      int var7 = var1.l();

      for(int var8 = 0; var8 < var4.getCount(); ++var8) {
         zala var3 = var4.b(var8);
         if (!var3.b()) {
            com.aspose.cells.b.a.b.zt var6 = zbuk.a(var0, var3.g(), var4.b(var8).c(), var2);
            var6.a(var6.b() + (float)(2 * var7));
            if (var5.b() < var6.b()) {
               var5.a(var6.b());
            }

            if (var5.c() < var6.c()) {
               var5.b(var6.c());
            }
         }
      }

      return var5;
   }

   static void a(zn var0, zakw var1, boolean var2, zbcp var3) throws Exception {
      var1.d().z();
      com.aspose.cells.b.a.b.zp var4 = new com.aspose.cells.b.a.b.zp(var1.d().a.c(), var1.d().a.d(), var1.d().a.e(), var1.d().a.f());
      int var6;
      if (!var1.d().q() && !var1.d().r() && var1.d().s()) {
         int var5 = var1.d().u();
         if (var5 > var1.d().a.e()) {
            var4.a(var4.c() + (var5 - var1.d().a.e()) / 2);
         }

         var6 = var1.d().v();
         if (var6 > var1.d().a.f()) {
            var4.b(var4.d() + (var6 - var1.d().a.f()) / 2);
         }
      }

      ArrayList var53 = var1.f().a(var1.h(), var2);
      var6 = var53.size();
      zif var7 = var1.c();
      if (!var1.d().D()) {
         com.aspose.cells.b.a.b.zc var8 = zax.a(var1.d().d(), com.aspose.cells.a.c.zn.a(var4));

         try {
            var0.a(var8, var4);
         } finally {
            if (var8 != null) {
               var8.f();
            }

         }

         if (var1.d().f().f()) {
            zama.a(var0, var4, var1.d().f());
         }
      }

      float var54 = (float)var7.b() / 3.0F;
      com.aspose.cells.b.a.b.zt var9 = b(var0, var1);
      int var10 = var1.k();
      int var11 = var1.l();
      float var12 = var1.p();
      float var13 = var1.q();
      int var14 = 1;
      int var15 = var4.e();
      int var16 = var4.f();
      float var19 = 0.0F;
      float var20 = 0.0F;
      com.aspose.cells.b.a.b.zt var21 = com.aspose.cells.b.a.b.zt.a();
      int var22 = 0;
      com.aspose.cells.b.a.b.zt var23 = com.aspose.cells.b.a.b.zt.a();
      com.aspose.cells.b.a.b.zt var24 = a(var0, var1, new com.aspose.cells.b.a.b.zt((float)var7.a(), (float)var7.b()));
      int var25 = (int)(var9.b() * (float)var6 + var24.b());
      boolean var26 = false;
      int var17;
      if (var25 <= var15 - var10) {
         var17 = var6;
         byte var18 = 1;
         var19 = (float)(var15 - var10 - var25) / (float)var6;
         var20 = (float)(var16 - var1.j() * var18) / (float)var18;
         var26 = true;
      } else {
         int var27 = var4.e() - var10;
         int var28 = var27 - (int)var9.b();
         var23 = new com.aspose.cells.b.a.b.zt((float)var28, var54);
         var21 = b(var0, var1, var23);
         var22 = (int)(var9.b() + var21.b());
         var17 = var22 == 0 ? 1 : zbuk.b((double)((float)var27 / (float)var22));
         if (var17 < 1) {
            var17 = 1;
         }

         int var55 = zbuk.a((double)((float)var6 / (float)var17));
         if (var55 > 1 && var17 > var55) {
            int var29 = (int)Math.ceil((double)((float)var6 / (float)var55));
            if (var29 < var17) {
               var17 = var29;
            }
         }

         var19 = (float)(var27 - var22 * var17) / (float)var17;
         var20 = ((float)var16 - var21.c() * (float)var55) / (float)var55;
         var14 = zbuk.a((double)(var21.c() / var1.d().C()));
      }

      if (var19 < 0.0F) {
         var19 = 0.0F;
      }

      if (var14 > 1) {
         if (var20 < var13) {
            var20 = var13;
         }
      } else if (var20 < var12) {
         var20 = var12;
      }

      float var56 = (float)var4.c();
      float var57 = (float)var4.d();
      var56 += (float)var10;
      var56 += var19 / 2.0F;
      var57 += Math.abs(var20) / 2.0F;
      com.aspose.cells.b.a.b.a.zf var58 = var0.e();
      com.aspose.cells.b.a.b.zq var30 = var0.f();
      var0.a(var4);
      com.aspose.cells.b.a.b.zv var31 = new com.aspose.cells.b.a.b.zv(com.aspose.cells.b.a.b.zv.c());

      for(int var32 = 0; var32 < var53.size(); ++var32) {
         zala var33 = (zala)var53.get(var32);
         if (var57 > (float)var4.j()) {
            break;
         }

         com.aspose.cells.b.a.b.zq var34 = new com.aspose.cells.b.a.b.zq(var56, var57, var9.b(), var9.c());
         a(var0, var1, var34, var33);
         String var35 = var33.g();
         com.aspose.cells.b.a.b.zo var36 = new com.aspose.cells.b.a.b.zo(var56 + var9.b() + (float)var11, var57);
         float var38;
         if (var33.a().c() || var33.a().d()) {
            com.aspose.cells.b.a.b.zg var37 = var33.d();
            var38 = (float)Math.ceil((double)var0.a().a(var37));
            float var39 = var38 * (float)var37.b().c(var37.k()) / (float)var37.b().e(var37.k());
            float var40 = var38 * (float)var37.b().d(var37.k()) / (float)var37.b().e(var37.k());
            float var41 = var38 * (float)var37.b().f(var37.k()) / (float)var37.b().e(var37.k());
            float var42 = var41 - var39 - var40;
            float var43 = var36.e() - (var41 - var38) / 2.0F + var39;
            com.aspose.cells.b.a.b.zg var44 = var33.c();
            float var45 = (float)Math.ceil((double)var0.a().a(var44));
            float var46 = var45 * (float)var44.b().d(var44.k()) / (float)var44.b().e(var44.k());
            float var47 = var45 * (float)var44.b().c(var44.k()) / (float)var44.b().e(var44.k());
            float var48 = var45 * (float)var44.b().f(var44.k()) / (float)var44.b().e(var44.k());
            float var49 = var48 - var47 - var46;
            float var50 = var43 - var47 - 1.0F;
            var36.b(var50 - (float)(var33.a().e() / 100.0D * (double)var38));
         }

         if (var26) {
            var0.a(var35, var33.c(), new com.aspose.cells.b.a.b.zu(var33.e()), var36.d(), var36.e(), var31);
            com.aspose.cells.b.a.b.zs var59 = var4.b();
            if ((float)var59.c() < var1.d().C()) {
               var59.b(zbuk.c((double)(var1.d().C() + 1.0F)));
            }

            com.aspose.cells.b.a.b.zt var61 = zbuk.a(var0, var35, var1.d().h(), var59);
            var56 += var9.b() + var61.b() + (float)(2 * var11);
            if (var7.aq() == ImageFormat.getEmf() && var33.c().h() <= 8.0F) {
               if (var33.c().h() <= 6.0F) {
                  var56 += (float)var35.length() / 5.0F * (float)var11;
               } else if (var33.c().h() <= 8.0F) {
                  var56 += (float)var35.length() / 10.0F * (float)var11;
               }
            }

            var56 += var19;
         } else {
            float var60 = (float)zbuk.a((double)var23.b());
            var38 = var23.c();
            com.aspose.cells.b.a.b.zq var62 = new com.aspose.cells.b.a.b.zq(var36.d(), var36.e(), var60, var38);
            var0.a(var35, var33.c(), new com.aspose.cells.b.a.b.zu(var33.e()), (com.aspose.cells.b.a.b.zq)var62, var31);
            var56 += (float)var22;
            var56 += var19;
            if ((var32 + 1) % var17 == 0) {
               var56 = (float)(var4.c() + var10) + var19 / 2.0F;
               var57 += var21.c();
               var57 += var20;
            }
         }
      }

      var0.a(var58);
   }

   static void a(zn var0, zakw var1, com.aspose.cells.b.a.b.zq var2, zala var3) {
      if (var3.h() == 2) {
         com.aspose.cells.b.a.b.zo var4 = new com.aspose.cells.b.a.b.zo(var2.f(), var2.g() + var2.i() / 2.0F);
         com.aspose.cells.b.a.b.zo var5 = new com.aspose.cells.b.a.b.zo(var2.l(), var2.g() + var2.i() / 2.0F);
         zama.a(var0, var4, var5, var3.j().d());
      } else if (var3.h() == 1) {
         zbcp var16 = var3.i();
         float var17;
         if (var16.au()) {
            var17 = (float)var1.m();
            com.aspose.cells.b.a.b.zq var6 = new com.aspose.cells.b.a.b.zq(var2.f(), var2.g() + (var2.i() - var17) / 2.0F, var17, var17);
            com.aspose.cells.b.a.b.zc var7 = zax.a(var16.A(), var6);

            try {
               var0.a(var7, var6);
            } finally {
               if (var7 != null) {
                  var7.f();
               }

            }

            com.aspose.cells.b.a.b.zm var8 = zama.a(var16.z());

            try {
               var0.a(var8, var6);
            } finally {
               if (var8 != null) {
                  var8.r();
               }

            }
         } else {
            float var18;
            if (var16.aj()) {
               if (var16.z().e()) {
                  zama.a(var0, var2.f(), var2.g() + var2.i() / 2.0F, var2.f() + var2.h(), var2.g() + var2.i() / 2.0F, var16.z());
               }

               if (var16.B().d() != 1) {
                  var17 = var2.f() + var2.h() / 2.0F;
                  var18 = var2.g() + var2.i() / 2.0F;
                  float var19;
                  if (var16.B().c() == 0) {
                     var19 = var2.i() * b;
                  } else {
                     int var20 = (int)((float)(var16.h().c() * 72) / var0.g());
                     if ((float)var20 <= var2.i() * b) {
                        var19 = (float)var16.B().c();
                     } else {
                        float var9 = (float)(var20 / var16.v().i().m());
                        if (var9 > 1.0F) {
                           var9 = 1.0F;
                        }

                        var19 = var2.i() * b * (1.0F + var9);
                        var19 = (float)((int)((double)(var19 * var0.g() / 72.0F) + 0.5D));
                     }
                  }

                  a(var0, var17, var18, var16.B(), var19, true);
               }
            } else {
               var17 = var2.h();
               var18 = (float)var1.m();
               com.aspose.cells.b.a.b.zq var21 = new com.aspose.cells.b.a.b.zq(var2.f(), var2.g() + var2.i() / 2.0F - var18 / 2.0F, var17, var18);
               var21 = zbuk.a(var21);
               zax.a(var0, var21, var16.A());
               zama.a(var0, var21, var16.z());
            }
         }
      }

   }
}
